package com.consumerzk.consumerzk.controller;

import com.common.test.UserService;
import com.consumerzk.consumerzk.rpc.RpcConsumerZk;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

     @Autowired
    private RpcConsumerZk rpcConsumerZk;

    @RequestMapping("/test")
    public String test(){
        UserService proxy = null;
         try {
             proxy = (UserService) rpcConsumerZk.createProxy(UserService.class);
         } catch (ClassNotFoundException e) {
             e.printStackTrace();
         }
         String s = proxy.sayHello("success");
         System.out.println("=========="+s+"==========");
        return s;
    }
}

